<%@ page language="java" session="true"%>
<%@ page import="java.util.ArrayList" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%
        response.setHeader("Expires", "-1");
        response.setHeader("Cache-Control", "no-store");
        response.setHeader("Pragma", "no-cache");
		
		ArrayList oISSOBrokers = null;
		ArrayList oILinkBrokers = null;
		ArrayList oIContactBrokers = null;

		if (session.getAttribute("ISSOBrokers") != null)
			oISSOBrokers = (ArrayList) session.getAttribute("ISSOBrokers");
		if (session.getAttribute("ILinkBrokers") != null)
			oILinkBrokers = (ArrayList) session.getAttribute("ILinkBrokers");
		if (session.getAttribute("IContactBrokers") != null)
			oIContactBrokers = (ArrayList) session.getAttribute("IContactBrokers");

%>
<html>
  <head>
	<SCRIPT LANGUAGE="JavaScript">
		<!--
		javascript:window.history.forward(1);
		
		function initialize()
		{
			document.LoginForm.service.selectedIndex = 0;
			document.LoginForm.synonym.focus();
			document.LoginForm.synonym.value="=";
		}
		
		function populateIBroker()
		{
			<% int len = 0; %>   
			var opt = new Option("", "");
			if (document.LoginForm.service.selectedIndex==0)
			{
				document.LoginForm.IBroker.options.length = 0;
				<%
  					if (oISSOBrokers != null)
  					{
	  					len = oISSOBrokers.size();
	  					for (int i=0; i<len; i++)
	  					{
	  						net.amsoft.iservice.isso.hibernate.IBroker broker = 
	  								(net.amsoft.iservice.isso.hibernate.IBroker) oISSOBrokers.get(i);
				%>
							opt = new Option("<%=broker.getDescription()%>", "<%=broker.getServerName()%>");
							document.LoginForm.IBroker.options[<%=i%>] = opt;
				<%
						}
					}
				%>
			}
			if (document.LoginForm.service.selectedIndex==1)
			{
				document.LoginForm.IBroker.options.length = 0;
				<%
  					if (oILinkBrokers != null)
  					{
	  					len = oILinkBrokers.size();
	  					for (int i=0; i<len; i++)
	  					{
	  						net.amsoft.iservice.ilink.hibernate.IBroker broker = 
	  								(net.amsoft.iservice.ilink.hibernate.IBroker) oILinkBrokers.get(i);
				%>
							opt = new Option("<%=broker.getDescription()%>", "<%=broker.getServerName()%>");
							document.LoginForm.IBroker.options[<%=i%>] = opt;
				<%
						}
					}
				%>
			}
			if (document.LoginForm.service.selectedIndex==2)
			{
				document.LoginForm.IBroker.options.length = 0;
				<%
  					if (oIContactBrokers != null)
  					{
	  					len = oIContactBrokers.size();
	  					for (int i=0; i<len; i++)
	  					{
	  						net.amsoft.iservice.icontact.hibernate.IBroker broker = 
	  								(net.amsoft.iservice.icontact.hibernate.IBroker) oIContactBrokers.get(i);
				%>
							opt = new Option("<%=broker.getDescription()%>", "<%=broker.getServerName()%>");
							document.LoginForm.IBroker.options[<%=i%>] = opt;
				<%
						}
					}
				%>
			}
		}
		//-->
	</SCRIPT>

    <title><bean:message key="ibroker.login.title" /></title>
    <link rel="stylesheet" type="text/css" href="styleSheets/iservices.css" />
  </head>
  
  <body onLoad="initialize();">
  <html:form action="/Login" method="post">
  <table align="center" width="100%" height="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td align=center valign="middle">
			<table border=0 cellspacing=0 cellpadding=0 background="images/default/grey-bg.gif" width=300>
				<tr height="45px">
					<td height="45px" width="10px" bgcolor="#999999"><img src="images/default/grey-square.gif"></td>
					<td height="45px" bgcolor="#999999" align="left" valign="middle">
						<img src="images/default/title_manager_login.gif">
					</td>
					<td height="45px" width="10px" bgcolor="#999999"><img src="images/default/grey-square.gif"></td>
				</tr>
				<tr>
					<td width="10px" bgcolor="#999999"><img src="images/default/grey-square.gif"></td>
					<td>
						<table cellpadding="0" cellspacing="0">
							<tr bgcolor="#999999" background="images/default/manager_heading.jpg">
								<td bgcolor="#999999" colspan="2" align="left" height="50px">
									<img src="images/default/manager_heading.jpg" />
								</td>
							</tr>
							<tr>
								<td width="10px"></td>
								<td height="10px" class="black-smalltext"></td>
							</tr>
							<tr>
							 	<td colspan="2" class="blue-smalltext"><b>&nbsp;&nbsp;<html:errors /></b></td>
							</tr>
							<tr>
					            <td width="10px"></td>
								<td height="8px"></td>
							</tr>
					  		<tr>
					  			<td width="10px" height="32px" class="black-smalltext">&nbsp;<bean:message key="ibroker.login.iname" /></td>
					  			<td width="10px" height="32px" class="black-smalltext"><html:text property="synonym" size="21" value="" styleClass="textbox" /></td>
					  		</tr>
					  		<tr>
					  			<td width="10px" height="32px" class="black-smalltext">&nbsp;<bean:message key="ibroker.login.service" /></td>
					  			<td width="10px" height="32px" class="black-smalltext">
						  			<html:select property="service" style="width:143px" onchange="populateIBroker();">
										<html:option value="isso"><bean:message key="isso" /></html:option>
										<html:option value="ilink"><bean:message key="ilink" /></html:option>
										<html:option value="icontact"><bean:message key="icontact" /></html:option>
									</html:select>
								</td>  			
					  		</tr>
					  		<tr>
					  			<td width="10px" height="32px" class="black-smalltext">&nbsp;<bean:message key="ibroker.login.broker" /></td>
					  			<td width="10px" height="32px" class="black-smalltext">
						  			<html:select property="IBroker" style="width:143px" >
						  				<%
						  					if (oISSOBrokers != null)
						  					{
							  					len = oISSOBrokers.size();
							  					for (int i=0; i<len; i++)
							  					{
							  						net.amsoft.iservice.isso.hibernate.IBroker opt = 
							  								(net.amsoft.iservice.isso.hibernate.IBroker) oISSOBrokers.get(i);
						  				%>
													<html:option value="<%=opt.getServerName()%>"><%=opt.getDescription()%></html:option>
										<%
												}
											}
										%>
									</html:select>
								</td>  			
					  		</tr>
					  		<tr>
					  			<td>&nbsp;</td>
					  			<td>&nbsp;</td>
					  		</tr>
					  		<tr>
					  			<td>&nbsp;</td>
					  			<td>&nbsp;</td>
					  		</tr>
					  		<tr>
								<td width="33%">&nbsp;</td>
					  			<td colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						  			<a href="#">
						  				<img border="0" src="images/default/button-submit.jpg" onclick="LoginForm.submit();" alt="Submit" align="center" />
									</a>
								</td>
					  		</tr>
							<tr>
								<td width="10px"></td>
								<td height="32px" class="black-smalltext"></td>
							</tr>
							<tr>
								<td width="10px"></td>
								<td height="30px" class="black-smalltext"></td>
							</tr>
							<tr>
								<td height="2px" colspan="2">
									<img src="images/default/dotted-line.gif" />
								</td>
							</tr>
							<tr>
								<td width="10px"></td>
								<td height="32px" class="black-xsmalltext"></td>
							</tr>
						</table>
					</td>
					<td width="10px" bgcolor="#999999"><img src="images/default/grey-square.gif"></td>
				</tr>
				<tr height="10px">
					<td height="10px" colspan="3" bgcolor="#999999"><img src="images/default/grey-square.gif"></td>
				</tr>
		   	</table>
	   	</td>
	</tr>
  </table>
  </html:form>
  </body>
</html>
